package com.cssl.controller;

import com.cssl.service.SendSms;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

//@RestController
public class SendAction {

    @Autowired
    private SendSms ss;


    @RequestMapping("send")
    public void send(){

        int appid = 1400523533; //应用列表ID
        String appkey  = "ee86605acd18b15abb88c6074c346126";//应用列表key

        int templateId = 970441;//模板ID
        String smsSign = "豆你笑公众号";//签名内容

        try {
            String[] params = {"袁亚玲"};//短信中对应的内容
            SmsSingleSender ss = new SmsSingleSender(appid,appkey);
            //86代表国内
            SmsSingleSenderResult sr = ss.sendWithParam("86","18229155429",templateId,params,smsSign,"","");
            //打印发送信息
            System.out.println(sr);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
